import React, { Component } from 'react'
import { connect } from 'react-redux'

class About extends Component {
    render() {
        console.log(this.props)
        const { count, addCount } = this.props
        return (
            <div>
                <h3>
                    About -- { count }
                </h3>
                <button onClick = {() => {
                    addCount(100)
                }}>+++</button>
            </div>
        )
    }
}

let mapState = (state) => {
    const { count } = state
    return {
        count
    }
}

let mapDispatch = (dispatch) => {
    return {
        addCount(count) {
            dispatch({ type: "ADD_COUNT", count })
        }
    }
}

About = connect(mapState, mapDispatch)(About)

export default About
